package com.mf.controller;

import com.mf.bo.DateScopedBo;
import com.mf.entity.Code;
import com.mf.result.Result;
import com.mf.service.ICodeService;
import com.mf.service.IMonthCodeHistoryService;
import com.mf.service.IWeekCodeHistoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
* <p>
    * 股票历史周数据 前端控制器
    * </p>
*
* @author mf
* @since 2024-06-21
*/
@RestController
@RequestMapping("/monthCodeHistory")
public class MonthCodeHistoryController {
    @Resource
    private IMonthCodeHistoryService monthCodeHistoryService;

    @Resource
    private ICodeService codeService;
    /**
     * 月历史数据添加
     */
    @PostMapping("/saveBatchAll")
    public Result<Void> saveBatchAll(@RequestBody DateScopedBo dateScoped, @RequestParam("dm") String dm)
    {
        final List<Code> codeList = codeService.findAll(dm);
        monthCodeHistoryService.saveBatchAll(dateScoped,codeList);
        return Result.success();
    }
}
